package main

import (
	"fmt"
	"os"

	"github.com/rs/zerolog/log"
	"github.com/spf13/cobra"

	// "wiseverds.com/frame/webport/src/service/webport_sp1"
	// "wiseverds.com/frame/webport/src/service/webport_ss1"
	"wiseverds.com/frame/webport/src/service/webport_web"
)

func runStartCmd(cmd *cobra.Command, args []string) {
	log.Debug().Str("func", "runStartCmd").Msg("Starting web server")
	webServer := webport_web.NewWebServer()
	webServer.Start()

	// log.Debug().Str("func", "runStartCmd").Msg("Starting sp1 server")
	// sp1 := webport_sp1.NewProxy()
	// sp1.Start()

	// log.Debug().Str("func", "runStartCmd").Msg("Starting ss1 server")
	// serverSS1 := webport_ss1.NewServer(sp1)
	// serverSS1.Start()

	sigChan := make(chan os.Signal)
	sig := <-sigChan
	fmt.Printf("Got signal: %v\n", sig)
}

var startCmd = &cobra.Command{
	Use:   "start",
	Short: fmt.Sprintf("Start the %s service", Program),
	Args:  cobra.MinimumNArgs(0),
	Run:   runStartCmd,
}

func init() {
	rootCmd.AddCommand(startCmd)
}
